home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group95b.txt / 000142_icon-group-sender _Wed Aug 30 12:25:00 1995.msg < prev    next >
Internet Message Format  |  1995-09-18  |  4KB

  1. Received: by cheltenham.cs.arizona.edu; Wed, 30 Aug 1995 09:57:07 MST
  2. Message-Id: <199508301641.MAA09868@transfer.stratus.com>
  3. Date:           Wed, 30 Aug 95 12:25 EDT
  4. From: Steve_Graham@vos.stratus.com
  5. To: icon-project@cs.arizona.edu
  6. Cc: Steve_Graham@vos.stratus.com
  7. Subject:        Question
  8. Errors-To: icon-group-errors@cs.arizona.edu
  9.  
  10. Dear Sir/Madam:
  11.  
  12.    I had originally sent this to icon-info@cs.arizona.edu.  However, it
  13. was returned due to unknown user.  I will try an alternate address.
  14.  
  15. Thanks.
  16.  
  17. --------------------------Original Letter--------------------------------
  18.  
  19. Dear Sir/Madam:
  20.  
  21.    I've read with interest the entries in the comp.lang.icon newgroup and
  22. have ordered a copy of Icon.  I enjoy the many built-in features which
  23. can facilitate many text manipulation tasks.
  24.  
  25.    I do have a question about the attached program which I am developing. I
  26. am hoping that someone can point out what I am doing wrong.  I am sending
  27. this via e-mail, inasmuch as I do not have the capability to post to the
  28. conference, although I can read posted messages.  Perhaps someone could post
  29. this to the conference.
  30.  
  31.    I am trying to prompt the user to put in a file name. The good news is
  32. the program does receive the program name which I type in. The bad news is
  33. that I do not see the prompt(s) until after I type in the file name. The
  34. problem may be that I do not know how to stipulate to which file (ie, CON) I
  35. am writing. Any comments?
  36.  
  37. Thanks in advance.
  38. Steve_Graham@vos.stratus.com
  39.  
  40. #
  41. #          CORRECT .H FILE
  42. #
  43.  
  44. #  This program fixes the following problems in the t2a*.h file:
  45. #
  46. #  . Eliminates duplicate numbers;
  47. #  . Corrects the _APS_NEXT_CONTROL_VALUE value; and
  48. #  . Positions the MF_F and MF_V fields together
  49.  
  50. procedure main()
  51.    local i,j
  52.    static numbers
  53.    initial numbers := "0"
  54.    every i1 := ( 1 to 9 ) do
  55.       numbers := numbers || i1
  56.    con_file_name   := "CON.XXX"
  57.    write("Calling getfile with ",con_file_name)
  58.    write("Prompting for source file: ")
  59.    in_file_name := getfile()
  60.    write("Calling storelines")
  61.    storelines(con_file_name,in_file_name,numbers)
  62. end
  63.  
  64. procedure getfile(con_file_name)
  65.    in_file_name  := read()
  66.    return (in_file_name)
  67. end
  68.  
  69. procedure storelines(con_file_name,in_file_name,numbers)
  70.    local i, j, line, linelist, lines, nbr, pair, t, x, y
  71.    static letters
  72.    initial letters := &lcase ++ &ucase
  73.    lines := table(0)
  74.    t := 0
  75.    write("in_file_name(SP): ",in_file_name)
  76.    in_file_num  := open(in_file_name,"ru")
  77.    while line := read(in_file_num) do {    
  78.       t := t + 1
  79.       nbr := 1000 + t
  80.       nbr := nbr[2:0]
  81.       lines[nbr] := line
  82.       }
  83.    linelist := sort(lines)
  84.    define_nums := table(0)
  85.    write("The ",t," lines are: ")
  86.    every pair := !linelist do {
  87.       if (i := find("#define",pair[2])) = 1
  88.          then {
  89.                write(pair[1],": ",pair[2])
  90.                j := findnumber(pair[2],numbers)
  91.                k := define_nums[j] + 1
  92.                define_nums[j] := k
  93.                write(" -->",j)
  94.                if k>1 then write(" *** Duplicate ***")
  95.                }
  96.          else write(pair[1],": ",pair[2])
  97.       }
  98.    define_num_list := sort(define_nums)
  99.    every pair := !define_num_list do 
  100.       write(pair[1],": ",pair[2])
  101. end
  102.  
  103. procedure findnumber(linea,numbers)
  104.    local i, substr
  105.    substr := ""
  106.    linea ? if (i := find(" ",linea))>10 then {
  107.       i := tab(i)
  108.       i := tab(upto(numbers))
  109.       substr := tab(many(numbers))
  110.       }
  111.    return substr
  112.    end        
  113.  
  114.